﻿Public Class AdminUtility
    Dim oEncript As New crypt
    Dim Var As New varDeclare

    Private Sub btnStart_Click(sender As Object, e As EventArgs) Handles btnStart.Click
        If (cmbType.Text <> "") Then
            Select Case cmbType.Text
                Case "Encrypt SHA"
                    txtResult.Text = oEncript.EncryptSHA(txtText.Text.Trim())
                Case "Decrypt SHA"
                    txtResult.Text = oEncript.DecryptSHA(txtText.Text.Trim())
                Case "Encrypt MD5"
                    txtResult.Text = oEncript.EncryptMD5(txtText.Text.Trim())
            End Select
        Else : txtResult.Text = ""
        End If
    End Sub

    Private Sub btnASCII_Click(sender As Object, e As EventArgs) Handles btnASCII.Click
        txtASCII_Result.Text = ""
        For Each chr As Char In Me.txtASCII_Raw.Text
            txtASCII_Result.Text += Asc(chr).ToString() & "-"
        Next
        txtASCII_Result.Text = txtASCII_Result.Text.Remove(txtASCII_Result.Text.Length - 1)

        Dim asciiChars As Array = txtASCII_Result.Text.Split("-")
        txtASCII_Raw.Text = ""
        For Each asciiChar As String In asciiChars
            txtASCII_Raw.Text += Chr(asciiChar)
        Next
    End Sub
End Class